function photoAlbumn(photoObj,btnObj,numObj){
var moveNum = 1,
 _void=true,
 cloneObj,nums,
 voidClone=false,
 d=document,
 elem = d.getElementById(photoObj),
 btnObj=d.getElementById(btnObj),
 numObj=d.getElementById(numObj);
if (!elem) return false;
if (!btnObj) return false;
var elemObj = elem.getElementsByTagName("li"),
 autoWidth = elemObj[0].offsetWidth,
 btns = btnObj.getElementsByTagName("span"),
 max=elemObj.length;
 elem.style.width = (max+1)*autoWidth + "px";
var numElement =function(){
if(numObj){
 nums = numObj.getElementsByTagName("em");
 nums[1].innerHTML = max;
 nums[0].innerHTML = moveNum;
 }
}
var moveElement =function(final_x,final_y,interval){
 _void = false;
 var step = function () {
  if (elem.movement) clearTimeout(elem.movement);
  if (!elem.style.left) elem.style.left = "0px";
  if (!elem.style.top) elem.style.top = "0px";
  var xpos = parseInt(elem.style.left);
  var ypos = parseInt(elem.style.top);
  //alert(xpos)
  if (xpos == final_x && ypos == final_y) {
   _void = true;
if(voidClone){
  elem.style.left = (moveNum > 2)?(-(max-1)*autoWidth +"px"):"0px";
  elem.removeChild(cloneObj);
  voidClone = false;
 }
   return true;
  }
  if (xpos < final_x) {
    var dist = Math.ceil((final_x - xpos)/10);
    xpos = xpos + dist;
  }
  if (xpos > final_x) {
    var dist = Math.ceil((xpos - final_x)/10);
    xpos = xpos - dist;
  }
  if (ypos < final_y) {
    var dist = Math.ceil((final_y - ypos)/10);
    ypos = ypos + dist;
  }
  if (ypos > final_y) {
    var dist = Math.ceil((ypos - final_y)/10);
    ypos = ypos - dist;
  }
  elem.style.left = xpos + "px";
  elem.style.top = ypos + "px";
  elem.movement = setTimeout(function(){step()},interval);
}
 elem.movement = setTimeout(function(){step()},interval);
} ;
var moveAutoShow = function (){
 moveNum++;
 if(moveNum > max){
  cloneObj = elemObj[0].cloneNode(true);
  elem.appendChild(cloneObj);
  voidClone = true;
 }
 moveElement(-autoWidth*(moveNum-1),0,5);
 if(moveNum > max) moveNum=1;
 numElement();
};
var prepareSlideshow = function (){
 var moveAuto = setInterval(function(){moveAutoShow()},5000);
  
};
numElement();
prepareSlideshow();
}
